/* ===================================
   GLOBAL STYLES & RESET
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ===================================
   MAIN CONTAINER - Responsive Height
   =================================== */
#app-container {
    width: 100%;
    height: 450px; /* Default for iframe */
    position: relative;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Standalone mode - use 90vh */
@media (min-height: 500px) {
    body:not(.iframe-mode) #app-container {
        height: 90vh;
    }
}

/* ===================================
   TOOLTIP (Header Information)
   =================================== */
.tooltip {
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    color: #333;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
    max-width: 90%;
    text-align: center;
}

#app-container:hover .tooltip {
    opacity: 1;
}

/* ===================================
   STORY PANEL (Introduction)
   =================================== */
.story-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.character-avatar {
    font-size: 80px;
    margin-bottom: 15px;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.dialogue-box {
    background: white;
    border-radius: 20px;
    padding: 20px 25px;
    max-width: 600px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    margin-bottom: 20px;
    position: relative;
}

.dialogue-box::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-bottom: 15px solid white;
}

.dialogue-box p {
    font-size: 16px;
    line-height: 1.6;
    color: #333;
}

/* ===================================
   CUTE BUTTONS
   =================================== */
.cute-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px 40px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    min-height: 44px; /* Touch target size */
    min-width: 120px;
}

.cute-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.cute-button:active {
    transform: translateY(0);
}

/* ===================================
   GAME AREA
   =================================== */
#game-area {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 10px;
    gap: 10px;
}

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: space-around;
    background: white;
    border-radius: 15px;
    padding: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.status-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: bold;
    font-size: 16px;
    color: #333;
}

.status-icon {
    font-size: 20px;
}

/* ===================================
   REACTION CARD
   =================================== */
.card-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
}

.reaction-card {
    background: white;
    border-radius: 20px;
    padding: 20px;
    width: 100%;
    max-width: 600px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    position: relative;
    animation: slideIn 0.4s ease;
    min-height: 180px;
    display: flex;
    flex-direction: column;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.card-number {
    position: absolute;
    top: 10px;
    right: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
}

.reaction-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 10px;
}

.reaction-equation {
    font-size: 18px;
    font-weight: bold;
    color: #667eea;
    text-align: center;
    padding: 10px;
    background: #f0f4ff;
    border-radius: 10px;
}

.reaction-description {
    font-size: 14px;
    line-height: 1.6;
    color: #555;
    text-align: center;
}

/* ===================================
   CLASSIFICATION BUTTONS
   MODIFIED: Adjusted for longer text labels
   =================================== */
.classification-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    padding: 0 10px 10px 10px;
}

.classify-btn {
    flex: 1;
    max-width: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    border: none;
    border-radius: 15px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-height: 50px; /* Touch target size */
    white-space: nowrap;
}

.fission-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
}

.fusion-btn {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    color: white;
}

.classify-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}

.classify-btn:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 24px;
}

/* MODIFIED: Adjusted font size for longer button labels */
.btn-label {
    font-size: 14px;
}

/* ===================================
   FEEDBACK DISPLAY
   =================================== */
.feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px 40px;
    border-radius: 20px;
    font-size: 24px;
    font-weight: bold;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    z-index: 100;
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    0% {
        transform: translate(-50%, -50%) scale(0);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

.feedback.correct {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    color: white;
}

.feedback.incorrect {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
}

/* ===================================
   RESULTS PANEL
   =================================== */
.results-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    padding: 15px;
    overflow-y: auto;
    animation: fadeIn 0.5s ease;
}

.results-content {
    background: white;
    border-radius: 20px;
    padding: 20px;
    max-width: 700px;
    width: 100%;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.results-title {
    text-align: center;
    color: #667eea;
    margin-bottom: 15px;
    font-size: 24px;
}

.results-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-item {
    background: #f0f4ff;
    padding: 12px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.stat-value {
    font-weight: bold;
    font-size: 20px;
    color: #667eea;
}

.stat-value.correct {
    color: #4ecdc4;
}

.stat-value.incorrect {
    color: #ff6b6b;
}

/* ===================================
   SUMMARY BOX
   =================================== */
.summary-box {
    background: #fff9e6;
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 15px;
    border: 2px solid #ffd700;
}

.summary-box h3 {
    color: #333;
    margin-bottom: 12px;
    font-size: 16px;
}

.summary-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.summary-type {
    background: white;
    padding: 12px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.summary-type strong {
    display: block;
    margin-bottom: 6px;
    color: #333;
    font-size: 14px;
}

.summary-type p {
    font-size: 13px;
    line-height: 1.5;
    color: #555;
    margin-bottom: 6px;
}

.summary-type .example {
    font-style: italic;
    color: #667eea;
    font-size: 12px;
}

/* ===================================
   PERFORMANCE FEEDBACK
   =================================== */
.performance-feedback {
    background: #f0f4ff;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    text-align: center;
}

.performance-feedback strong {
    display: block;
    margin-bottom: 8px;
    color: #667eea;
    font-size: 15px;
}

.performance-feedback p {
    font-size: 13px;
    line-height: 1.5;
    color: #555;
}

/* ===================================
   UTILITY CLASSES
   =================================== */
.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ===================================
   RESPONSIVE ADJUSTMENTS
   MODIFIED: Adjusted for longer button text
   =================================== */
@media (max-width: 600px) {
    .dialogue-box p {
        font-size: 14px;
    }
    
    .reaction-equation {
        font-size: 14px;
    }
    
    .reaction-description {
        font-size: 12px;
    }
    
    .classify-btn {
        font-size: 14px;
        padding: 12px 16px;
    }
    
    /* MODIFIED: Smaller font size for mobile to accommodate longer text */
    .btn-label {
        font-size: 12px;
    }
    
    .results-stats {
        grid-template-columns: 1fr;
    }
}

/* ===================================
   ACCESSIBILITY & INTERACTION STATES
   =================================== */
button:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Touch device optimization */
@media (hover: none) and (pointer: coarse) {
    .classify-btn,
    .cute-button {
        min-height: 48px; /* Larger touch targets for mobile */
    }
}